<?php

use backend\widgets\ActiveForm;
use common\widgets\JsBlock;

/* @var $this yii\web\View */
/* @var $model backend\models\JobType */
/* @var $form backend\widgets\ActiveForm */
?>
<div class="row">
    <div class="col-sm-12">
        <div class="ibox">
            <?= $this->render('/widgets/_ibox-title') ?>
            <div class="ibox-content">
                <?php $form = ActiveForm::begin([
                    'options' => [
                        'class' => 'form-horizontal'
                    ]
                ]); ?>
                <div class="hr-line-dashed"></div>
                <?= $form->field($model, 'name')->textInput(['maxlength' => true])->label('名称') ?>
                <div class="hr-line-dashed"></div>

                <?= $form->field($model, 'value')->textInput(['maxlength' => true, 'id' => 'value-int'])->label("值",
                    ['id' => 'value-int-label']) ?>
                <!--                --><? //= $form->field($model, 'value')->date(['id'     => 'value-date',
                //                                                         'type'   => 'date',
                //                                                         'format' => 'yyyy-MM-dd'
                //                ])->label("值", ['id' => 'value-date-label']) ?>
                <div class="hr-line-dashed"></div>

                <?= $form->field($model, 'type')->chosenSelect(\common\libs\Constants::getSearchPartTypes()) ?>
                <div class="hr-line-dashed"></div>

                <?= $form->defaultButtons() ?>
                <?php ActiveForm::end(); ?>
            </div>
        </div>
    </div>
</div>

<?php JsBlock::begin() ?>
<script>
    $(document).ready(function () {

        // $("#value-date").hide();
        // $("#value-date-label").hide();
        // alert(new Date("yyyy-MM-dd"));
        //$("#searchpart-type").on('change', function (evt, params) {
        //    // alert(typeof ($("#searchpart-type").val()));
        //
        //    if ($("#searchpart-type").val() == <?//=JobType::TYPE_TIME?>//) {
        //        $("#value-int-label").hide();
        //        $("#value-int").hide();
        //        date = new Date();
        //        $("#value-date").val(date.getFullYear() + '-' + date.getMonth() + '-' + date.getDay());
        //        $("#value-date").show();
        //        $("#value-date-label").show();
        //    }
        //})
    })
</script>
<?php JsBlock::end() ?>

